package main;

import java.util.Scanner;

import generator.BeanGeneratorTool;
import marker.MarkerTool;

import org.apache.log4j.Logger;

import directory.FormEngineTool;


/**
 * Classe principal de la toolbox, execute une sous appplication en fonction de
 * l'argument fournit
 * @author jchaline
 * 
 */
public class ToolLauncher
{
    private static final Logger logger = Logger.getLogger( ToolLauncher.class );
    public static final String GENERATOR = "generator";
    public static final String MARKER = "marker";
    public static final String FORMENGINE = "formengine";

    public static void main( String[] args )
    {
        String tool = null;
        if ( args.length != 1 )
        {
            Scanner sc = new Scanner( System.in );
            System.out.println( "Quel outil utiliser ?" );
            tool = sc.nextLine( );
            sc.close( );
        }
        else
        {
            tool = args[0];
        }

        switch ( tool )
        {
        case GENERATOR:
            BeanGeneratorTool.run( );
            break;
        case MARKER:
            MarkerTool.run( );
            break;
        case FORMENGINE:
            FormEngineTool.run( );
            break;
        default:
            logger.error( "Erreur lors du choix de l'outil" );
        }
    }
}
